﻿namespace VisualWip.Core.Columns
{
    public class LineColumn : Column
    {
        private string _color;
        private bool _isHorizontal;
        private int _thickness;

        public LineColumn()
        {
            Height = 300;
            Width = 300;
            PositionY = 0;
            ShowBorder = false;
            ShowHeader = false;
            Thickness = 5;
            IsHorizontal = true;
            Color = "Black";
        }

        public int Thickness
        {
            get { return _thickness; }
            set
            {
                if (_thickness != value)
                {
                    _thickness = value;
                    OnPropertyChanged(this, () => Thickness);
                }
            }
        }

        public bool IsHorizontal
        {
            get { return _isHorizontal; }
            set
            {
                if (_isHorizontal != value)
                {
                    _isHorizontal = value;
                    OnPropertyChanged(this, () => IsHorizontal);
                }
            }
        }

        public string Color
        {
            get { return _color; }
            set
            {
                if (_color != value)
                {
                    _color = value;
                    OnPropertyChanged(this, () => Color);
                }
            }
        }

        public override void DoRefresh()
        {
            //DoNothing
        }

       public override PersistenceTree Persist(string name)
        {
            PersistenceTree settings = base.Persist(name);
            settings.Add(() => Thickness);
            settings.Add(() => IsHorizontal);
            settings.Add(() => Color);
            return settings;
        }

        public override void Load(PersistenceTree settings)
        {
            base.Load(settings);
            Thickness = settings.Get(() => Thickness, 5);
            IsHorizontal = settings.Get(() => IsHorizontal, true);
            Color = settings.Get(() => Color, "Black");
        }

     }
}